//
//  WGCNoDataView.m
//  WisdomPhoneProject
//
//  Created by lc4y on 2017/11/24.
//  Copyright © 2017年 JianWei Chen. All rights reserved.
//

#import "CYNoDataView.h"
#import "CYListViewHeader.h"

@interface CYNoDataView ()

/** Description **/
@property(nonatomic,strong) UIImageView *cy_noDataImageView;

@property(nonatomic,strong) UILabel *cy_noDataLabel;

@end

@implementation CYNoDataView

- (void)layoutSubviews {
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [self.cy_noDataImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(-80);
        make.centerX.mas_equalTo(0);
    }];
    
    [self.cy_noDataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(50);
        make.right.mas_offset(-50);
        make.top.mas_equalTo(weakSelf.cy_noDataImageView.mas_bottom).offset(20);
    }];
}

- (void)cy_configNoDataImageN:(NSString *)noDataImageN {
    self.cy_noDataImageView.image = [UIImage imageNamed:noDataImageN];
}

- (void)cy_configNoDataTitleN:(NSString *)noDataTitleN {
    self.cy_noDataLabel.text = noDataTitleN;
}

-(UILabel *)cy_noDataLabel {
    if( !_cy_noDataLabel ) {
        _cy_noDataLabel = [UILabel new];
        
        _cy_noDataLabel.font = [UIFont systemFontOfSize:15];
        _cy_noDataLabel.cyNumberOfLines(0)
                       .cyTextAlignment(NSTextAlignmentCenter)
                       .cyTextColor([UIColor lightGrayColor])
                       .cyAddToSuperView(self);
    }
    
    return _cy_noDataLabel;
}

- (UIImageView *)cy_noDataImageView {
    if( !_cy_noDataImageView ) {
        _cy_noDataImageView = [UIImageView new];
        
        _cy_noDataImageView.contentMode = UIViewContentModeBottom;
        _cy_noDataImageView.cyAddToSuperView(self);
    }
    
    return _cy_noDataImageView;
}

@end
